Skip to content

docs(data-modeling): name what the lookup dependsOn formula check does not see on import - #38125

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37936-import-mappings-reach
Nov 28, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/issue-37936-import-mappings-reach

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Part of #37936

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:导入数据的人在文档的导入映射页上读到,作者时的检查在哪几种情况下看不到问题,导入时仍会遇到“无法在范围内查找”的提示;产品行为不变。
  • 为什么做:这是上一轮查找字段依赖筛选收严之后,复审留下的文档尾巴,原句把检查说得比实际更全。
  • 出错会怎样:只改一段文档,读者最多读到不准确的说明,可以直接撤回。
  • 要你做的:无(另一半,树形字段是否也该受检查,等席位转决策)。

What changes

content/docs/data-modeling/import-mappings.mdx, one paragraph. The sentence "so an import meets this sentence only on metadata stored before that check" overstated the authoring check that refuses a dependsOn filter key naming a formula of the target. It now says the check judges a lookup, master_detail or user field against the objects it can see, and names the cases where an import still meets the could-not-be-looked-up sentence. Each case was measured against origin/main at 6e06729 before it was named:

  1. Metadata stored before the check (unchanged from the old sentence).
  2. A tree field, or a legacy reference field. The lint resolves the referenced half only on PICKER_FIELD_TYPES = lookup, master_detail, user (packages/lint/src/validate-object-field-refs.ts:442, applied at :1002); the importer scopes by dependsOn on every type in IMPORT_REFERENCE_TYPES (packages/spec/src/data/field-value.zod.ts:154-155 adds tree, packages/spec/src/data/import-coercion.ts:44-47 adds reference; read at packages/core/src/utils/import-coerce.ts:1056-1061). Probe: the same task/project pair with the target field a formula gives one computed on read finding for lookup and master_detail, zero for tree and reference.
  3. os validate of a stack that does not hold both objects. The rule's graph is the validated stack alone (indexServedObjectGraph(stack), validate-object-field-refs.ts:683), the formula check reads graph.get(against)?.fields (:1054), and only the stack's own objects are walked (:998). Probe: a lookup whose target is not in the stack gives zero findings; the control with the formula target in the stack gives one. The same holds for the owning side: a target field turned into a formula in a package validated without the owning object is never judged there.

The card's third wording, "a target field changed from stored to formula after the owning object was published", was measured false for the runtime publish gate and is not named as a gap there. The gate's context is every object the environment serves, registry plus stored rows (packages/metadata-protocol/src/protocol-authoring-gate.ts:527-552); its differential drops the written item from the baseline (packages/lint/src/runtime-gate.ts:968) and charges findings the candidate adds (addedFindings, :1344). Probe: writing the target object with the field now a formula, while the owning object sits in the context, is refused with objects.pr_task.fields.project.dependsOn[0].param "acct_label" is a formula field of "pr_project", computed on read. The page says so in its last sentence. The case survives only on the CLI, as part of item 3.

Tests

Docs-only. No test changed. The measurements above came from a throwaway vitest file in packages/lint/src (deleted before commit, never pushed), run as pnpm --filter @objectstack/lint exec vitest run --maxWorkers=2 PROBE_FILE after building the lint dependency closure; it printed:

probe output (4 tests passed)
C ["objects[0].fields.project.dependsOn[0].param"]
CASE1 []
CASE3-tree []
CASE3-reference []
CASE3-master_detail ["objects[0].fields.project.dependsOn[0].param"]
CASE2-gate-target-write: includes objects.pr_task.fields.project.dependsOn[0].param ... computed on read
CASE2-control-owner-write ["objects.pr_task.fields.project.dependsOn[0].param"]
CASE1-gate-owner-write-target-absent []

Acceptance notes

N2 is measured here, not changed (the card stays open). Readings, each against origin/main at 6e06729:

  • (a) The spec. dependsOn's describe (packages/spec/src/data/field.zod.ts:2657) declares candidate-query scoping "For lookup/master_detail" and option gating for select/multiselect/radio; it names neither tree nor user nor reference. The Studio field form offers dependsOn only on lookup, master_detail, select, multiselect, radio, checkboxes (packages/spec/src/data/field.metadata-form.ts:327). Control: the schema itself does not gate dependsOn by type (field.zod.ts:2650), so a tree field carrying it parses.
  • (b) The importer. Scopes by dependsOn on lookup, master_detail, user, tree (REFERENCE_VALUE_TYPES, field-value.zod.ts:154-155) and reference (import-coercion.ts:44-47), read at import-coerce.ts:1056-1061. A tree with no reference is not scoped (:1056, !meta?.reference).
  • (c) The lint. Judges the referenced half of dependsOn only on lookup, master_detail, user (validate-object-field-refs.ts:442, :1002). Its docblock says on any other type "those keys have no reader" (:436-441). Counter-reading: the console renders tree with the lookup widget (ui/packages/fields/src/field-type-alias.ts:142, tree: 'field:lookup'), the widget that reads dependsOn. And a tree field's reference may only name its own object (packages/spec/src/data/object.zod.ts:2018), so its target is always in the stack the lint sees.
  • (d) Producers. git grep over examples/, packages/platform-objects/, skills/: tree fields at 3 source sites (examples/app-showcase/src/data/objects/field-zoo.object.ts:122, examples/app-showcase/src/ui/views/business-unit.view.ts:27, packages/platform-objects/src/identity/sys-business-unit.object.ts:55) plus one skill sample (skills/objectstack-data/rules/relationships.md:147); type: 'reference' at 0 sites. None of them carries dependsOn: zero files hold both outside a CHANGELOG.md and the skill page, whose dependsOn mention is the lookup paragraph at :106, not the tree sample. Control: the same grep finds dependsOn in 3 example object files (cascading-select, contact, invoice), all on lookup or option fields. Sibling repos (hotcrm, cloud) were not measured.

The two options the card names, for the seat:

  • A. The lint covers the importer's set (add tree and reference to the types whose dependsOn reference half is judged). Cost: a narrowing of @objectstack/lint (Clause-② narrowing, minor), zero known producers broken by (d). It matches the console, which already reads dependsOn on tree. reference is not a FieldType the parse accepts, so it only matters for legacy stored rows the lint sees. Size XS.
  • B. The importer stops scoping types the spec does not declare it for (scope only on lookup/master_detail, maybe user). Cost: an import behaviour change in @objectstack/core. A tree cell that is scoped today would resolve across the whole object, and the import would disagree with the console picker, which still filters a tree by dependsOn. Also needs a spec describe decision on user. Size S.

Recommendation: A. It closes the lint gap without opening a new one between the import and the picker. The spec describe would then name tree beside lookup/master_detail (prose that follows the ruling).

Verification

Two-minute check: open content/docs/data-modeling/import-mappings.mdx at the paragraph beginning "A dependsOn entry whose param names a target field". It should list three cases (stored metadata, tree/legacy reference, an os validate of a stack without both objects) and end saying the runtime publish gate refuses turning such a target field into a formula.

Read first: the one changed paragraph, lines 372-386.

…s not see on import

The import-mappings page said an import meets the "could not be looked up
within" sentence only on metadata stored before the authoring check. The
check judges lookup, master_detail and user fields against the objects it
can see: a tree or legacy reference field, which the import scopes by
dependsOn too, and an os validate of a stack that does not hold both
objects stay unjudged. The page now names those cases, and that the
runtime publish gate refuses turning a target field into a formula.

Claude-Session: https://claude.ai/code/session_017xRBcSAaBEfQpU2yJexSJ8
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet objectstack-fleet Bot added the skip-changeset PR has no user-facing published change; bypasses the changeset gate label Nov 28, 2026
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation labels Nov 28, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

L1: ACCEPT · head 38af7f0a9e586873066a8c177cf6e2f0c392bb58 · 2026-11-28T03:26Z · card #37936 (N1)

席位核对

  1. Shape — l1-face.mjs --pr 38125 clean: draft on main, first line Part of #37936, no closing keyword (N2 stays open on the card), docs-only with skip-changeset (no published package touched), Clause-②: no · Metadata-protocol: none.
  2. Premise measured — the dev measured each case the card's N1 names with a throwaway lint/runtime-gate probe (deleted, never committed): target outside the validated stack ⇒ no finding; tree / reference ⇒ no finding; master_detail ⇒ finding (CONTROL); runtime-gate publish of a target turned formula ⇒ refused. The card's third case was falsified for the runtime gate and survives only on the CLI; the page says so. The seat accepts the correction (the card's literal criterion is replaced by the measured one, written in the PR body).
  3. Gates at this head — check-runs: 30 success · 20 expected skip · 0 failed · 0 pending; Lint & Repo Gates and TypeScript Type Check success. check-governed-merges.mjs --pr 38125: NOT governed (+8/−2). landing-k.mjs: K = 7.
  4. Read by the seat — content/docs/data-modeling/import-mappings.mdx 376-386, sentence by sentence: the three cases and the runtime-gate sentence are true to the tree at this head (lint judges lookup/master_detail/user, validate-object-field-refs.ts:442; the runtime gate's context holds every served object, protocol-authoring-gate.ts:527-552).
  5. Accepted deviations — the PR body carries no attribution footer (relay stores bytes as sent); not a landing criterion.
  6. Out of scope — N2 → routed on the card (route A, comment of this seat), queued behind PR fix(lint)!: refuse a lookupFilters $record path to a structured field #38096 on the same lint file. ⚠️ Carried into that N2 dispatch: when route A lands, this page's "on a tree field or a legacy reference field … the check does not judge" case becomes false and is removed in the same PR. Skills-docs: not owed. L2: not owed.

Landing — non-governed docs PR: the seat lands it through the ordinary queue.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#8 · sunhaolin · session_017xRBcSAaBEfQpU2yJexSJ8

Landing · 2026-11-28T03:26Z · head 38af7f0a

probe reading
check-governed-merges.mjs --pr 38125 NOT governed · +8/−2 ≤ 3000
landing-k.mjs --pr 38125 K = 7 < 15

State: ready for review + auto-merge (L1 ACCEPT 7233074530). Part of #37936: the card stays open for N2.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 28, 2026 03:27
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 0e36120 Nov 28, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37936-import-mappings-reach branch November 28, 2026 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s skip-changeset PR has no user-facing published change; bypasses the changeset gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants